package com.example.map.myapplication;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.TextView;

import com.example.map.myapplication.fragments.A;
import com.example.map.myapplication.fragments.B;

/**
 * Created by qundui on 2017/5/25.
 */
public class TestAct extends FragmentActivity {
    public TextView getTv() {
        return tv;
    }
    private TextView tv;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);
        tv= (TextView) findViewById(R.id.tv1);
    }
    public void test(View view){
        A fragmentById = (A) getSupportFragmentManager().findFragmentById(R.id.f1);
//        Bundle bundle=new Bundle();
//        bundle.putString("x","I form act");
//        fragmentById.setArguments(bundle);;
//        getSupportFragmentManager().beginTransaction().replace(R.id.f1,fragmentById).commit();
        fragmentById.getTv().setText("I form act");

    }
    public void test2(View view){
        B fragmentById = (B) getSupportFragmentManager().findFragmentById(R.id.f2);
//        Bundle bundle=new Bundle();
//        bundle.putString("x","I form act");
//        fragmentById.setArguments(bundle);
//        getSupportFragmentManager().beginTransaction().replace(R.id.f2,fragmentById).commit();
      fragmentById.getTv().setText("I form act");

    }
}
